//
//	MHCircleSimpleInfo.m
//
//	Create by 正荣 许 on 19/12/2018
//	Copyright © 2018. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "MHCircleSimpleInfo.h"

NSString *const kMHCircleSimpleInfoAutoId = @"autoId";
NSString *const kMHCircleSimpleInfoCircleId = @"circleId";
NSString *const kMHCircleSimpleInfoCircleName = @"circleName";
NSString *const kMHCircleSimpleInfoMemberCount = @"memberCount";
NSString *const kMHCircleSimpleInfoRecentCount = @"recentCount";
NSString *const kMHCircleSimpleInfoRecentImgList = @"recentImgList";

@interface MHCircleSimpleInfo ()
@end
@implementation MHCircleSimpleInfo




+ (NSDictionary *)modelContainerPropertyGenericClass {
    
    return @{@"recentImgList"        : [MHRecentImgList class],
             };
}

/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kMHCircleSimpleInfoAutoId] isKindOfClass:[NSNull class]]){
		self.autoId = [dictionary[kMHCircleSimpleInfoAutoId] integerValue];
	}

	if(![dictionary[kMHCircleSimpleInfoCircleId] isKindOfClass:[NSNull class]]){
		self.circleId = [dictionary[kMHCircleSimpleInfoCircleId] integerValue];
	}

	if(![dictionary[kMHCircleSimpleInfoCircleName] isKindOfClass:[NSNull class]]){
		self.circleName = dictionary[kMHCircleSimpleInfoCircleName];
	}	
	if(![dictionary[kMHCircleSimpleInfoMemberCount] isKindOfClass:[NSNull class]]){
		self.memberCount = [dictionary[kMHCircleSimpleInfoMemberCount] integerValue];
	}

	if(![dictionary[kMHCircleSimpleInfoRecentCount] isKindOfClass:[NSNull class]]){
		self.recentCount = [dictionary[kMHCircleSimpleInfoRecentCount] integerValue];
	}

	if(dictionary[kMHCircleSimpleInfoRecentImgList] != nil && [dictionary[kMHCircleSimpleInfoRecentImgList] isKindOfClass:[NSArray class]]){
		NSArray * recentImgListDictionaries = dictionary[kMHCircleSimpleInfoRecentImgList];
		NSMutableArray * recentImgListItems = [NSMutableArray array];
		for(NSDictionary * recentImgListDictionary in recentImgListDictionaries){
			MHRecentImgList * recentImgListItem = [[MHRecentImgList alloc] initWithDictionary:recentImgListDictionary];
			[recentImgListItems addObject:recentImgListItem];
		}
		self.recentImgList = recentImgListItems;
	}
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	dictionary[kMHCircleSimpleInfoAutoId] = @(self.autoId);
	dictionary[kMHCircleSimpleInfoCircleId] = @(self.circleId);
	if(self.circleName != nil){
		dictionary[kMHCircleSimpleInfoCircleName] = self.circleName;
	}
	dictionary[kMHCircleSimpleInfoMemberCount] = @(self.memberCount);
	dictionary[kMHCircleSimpleInfoRecentCount] = @(self.recentCount);
	if(self.recentImgList != nil){
		NSMutableArray * dictionaryElements = [NSMutableArray array];
		for(MHRecentImgList * recentImgListElement in self.recentImgList){
			[dictionaryElements addObject:[recentImgListElement toDictionary]];
		}
		dictionary[kMHCircleSimpleInfoRecentImgList] = dictionaryElements;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:@(self.autoId) forKey:kMHCircleSimpleInfoAutoId];	[aCoder encodeObject:@(self.circleId) forKey:kMHCircleSimpleInfoCircleId];	if(self.circleName != nil){
		[aCoder encodeObject:self.circleName forKey:kMHCircleSimpleInfoCircleName];
	}
	[aCoder encodeObject:@(self.memberCount) forKey:kMHCircleSimpleInfoMemberCount];	[aCoder encodeObject:@(self.recentCount) forKey:kMHCircleSimpleInfoRecentCount];	if(self.recentImgList != nil){
		[aCoder encodeObject:self.recentImgList forKey:kMHCircleSimpleInfoRecentImgList];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.autoId = [[aDecoder decodeObjectForKey:kMHCircleSimpleInfoAutoId] integerValue];
	self.circleId = [[aDecoder decodeObjectForKey:kMHCircleSimpleInfoCircleId] integerValue];
	self.circleName = [aDecoder decodeObjectForKey:kMHCircleSimpleInfoCircleName];
	self.memberCount = [[aDecoder decodeObjectForKey:kMHCircleSimpleInfoMemberCount] integerValue];
	self.recentCount = [[aDecoder decodeObjectForKey:kMHCircleSimpleInfoRecentCount] integerValue];
	self.recentImgList = [aDecoder decodeObjectForKey:kMHCircleSimpleInfoRecentImgList];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	MHCircleSimpleInfo *copy = [MHCircleSimpleInfo new];

	copy.autoId = self.autoId;
	copy.circleId = self.circleId;
	copy.circleName = [self.circleName copy];
	copy.memberCount = self.memberCount;
	copy.recentCount = self.recentCount;
	copy.recentImgList = [self.recentImgList copy];

	return copy;
}
@end
